﻿using System;
using System.Collections.Generic;
using System.Text;
using MathNet.Numerics.LinearAlgebra;

namespace ImgProcessGui
{
    public class CreateRandom
    {
        Random random = new Random();
        public double[] RandomVector_double(int vectorSize,int minVal,int maxVal)
        {
            double[] arrRand = new double[vectorSize];
            for(int i=0; i<vectorSize;i++)
            {
                arrRand[i] = minVal + (maxVal-minVal)*random.NextDouble();
            }
            return arrRand;
            
        }
    }

    public class Norm
    {
        public double Norm2(double[] Vec1, double[] Vec2)
        {
            double diffArray=0;
            for (int i = 0; i < Vec1.Length; i++)
            {
                diffArray += (Vec1[i] - Vec2[i]) * (Vec1[i] - Vec2[i]);
            }
            return Math.Sqrt(diffArray);
        }

        public double Norm1(double[] Vec1, double[] Vec2)
        {
            double diffArray = 0;
            for (int i = 0; i < Vec1.Length; i++)
            {
                diffArray += Math.Abs(Vec1[i] - Vec2[i]);
            }
            return diffArray;
        }

        public double Norm1(Vector Vec1, Vector Vec2)
        {
            Vector dif = Vec1 - Vec2;
            double norm = 0;
            for (int i = 0; i < dif.Length; i++)
            {
                norm = norm + Math.Abs(dif[i]);
            }
            return norm;
        }



    }
}
